Skip to content

Conversation

@jishnub
Copy link
Member

@jishnub jishnub commented Apr 27, 2025

In the Diagonal tests, we often compare results of function evaluations with that for the corresponding dense matrix. E.g., with D = Diagonal(::Vector) and DM = Matrix(D),

@test log(Diagonal(abs.(D.diag)))  log(abs.(DM)) atol=n^3*eps(relty)

The problem with this is that, in the dense method log(::Matrix), we check if the matrix is diagonal, and dispatch to the Diagonal methods for performance. This makes this test useless, as we are comparing identical methods.

In this PR, I've changed the type of DM to be Hermitian for real matrices, and UpperTriangular for complex ones. Both of these types have special methods for log, at least. The Hermitian matrices have special methods for all the trigonometric functions, and for the complex matrices, we wrap these in a custom wrapper NotDiagonal that avoids the isdiag paths. This wrapper lies about the structure, but it should be ok for the testing purposes as we ensure that we are comparing different paths.

@codecov
Copy link

codecov bot commented Apr 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.71%. Comparing base (5d3d02a) to head (e022e2c).
Report is 27 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1316      +/-   ##
==========================================
- Coverage   93.72%   93.71%   -0.02%     
==========================================
  Files          34       34              
  Lines       15733    15733              
==========================================
- Hits        14746    14744       -2     
- Misses        987      989       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jishnub jishnub merged commit ea8e858 into master May 11, 2025
3 of 4 checks passed
@jishnub jishnub deleted the jishnub/diagdensttests branch May 11, 2025 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant